import request from '@/utils/request';
import { isProductionEnv } from '@/utils/utils';

// 新增一条统计记录
export async function onInitAnalytic(params) {
  return request('/user-behavior/userbehavior/addUserLog', {
    method: 'POST',
    data: params,
  });
}

// 修改一条统计记录
export async function onUpdateAnalytic(params) {
  return request('/user-behavior/userbehavior/updateUserLog', {
    method: 'POST',
    data: params,
  });
}

// 统计埋点记录(新接口)
export async function onNewInitAnalytic(params) {
  return request('/user-behavior/menuLog/addMenuLog', {
    method: 'POST',
    data: params,
  });
}

// 检查是否有调查问卷
export async function checkFeedList(params) {
  if (!isProductionEnv()) {
    return {
      checkPlatformFeedback: [],
      message: '请求正常',
      result: 'OK',
      statusCode: '1000',
    };
  }
  return request('/user/feedback/checkFeedback', {
    method: 'POST',
    data: params,
  });
}

// 提交调查问卷
export async function updateFeed(params) {
  return request('/user/feedback/updateFeedback', {
    method: 'POST',
    data: params,
  });
}
